/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.primecodegen.core;

import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.primecodegen.util.util;

import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;

/**
 *
 * @author Mohammad
 */
public class conf {

    private Configuration cfg = new Configuration();

    public conf() {
        init();
    }

    public Configuration getCfg() {
        return cfg;
    }

    public void init() {
        try {

            // Specify the data source where the template files come from.
            // Here I set a file directory for it:
            cfg.setDirectoryForTemplateLoading(new File(util.getBundleValue("RELATIVE_TEMPLATE_DIRECTORY")));
//            cfg.setDirectoryForTemplateLoading(new File(util.getBundleValue("TEMPLATE_DIRECTORY")));
            // Specify how templates will see the data-model. This is an advanced topic...
            // but just use this:
            cfg.setObjectWrapper(new DefaultObjectWrapper());
        } catch (IOException ex) {
            Logger.getLogger(conf.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
